<?php

header('Content-Type: text/xml; charset=utf-8', true);
echo '<?xml version="1.0" encoding="utf-8"?'.'>'; 

if (!defined( "APP_DIR" )) {
        define( "APP_DIR", dirname(__FILE__)."/app");
    }

	if (!defined( "ROOT_DIR" )) {
        define( "ROOT_DIR", dirname(__FILE__)."/");
    }
	$configFile = ROOT_DIR . '/config/config.php';
	$fleaFile = ROOT_DIR . '/lib/FLEA/FLEA.php';

	require($fleaFile);
	FLEA::loadAppInf($configFile);
	
	FLEA::import(APP_DIR);   
	$tbAlbum = FLEA::getSingleton('Model_Albums');
	$album = $tbAlbum->findAll(null,'album_id DESC',20);
?>
<feed
  xmlns="http://www.w3.org/2005/Atom"
  xmlns:thr="http://purl.org/syndication/thread/1.0"
  xml:lang="en"
  xml:base="<?php echo FLEA::getAppInf('webAddr');?>/atom.php"
 >
	<title type="text">Gothicc.com</title>
	<subtitle type="text"><?php echo FLEA::getAppInf('webDesc');?></subtitle>

	<generator uri="<?php echo FLEA::getAppInf('webAddr');?>">snout</generator>

	<link rel="alternate" type="text/html" href="<?php echo FLEA::getAppInf('webAddr');?>" />
	<id><?php echo FLEA::getAppInf('webAddr');?>/atom.php</id>
	<link rel="self" type="application/atom+xml" href="<?php echo FLEA::getAppInf('webAddr');?>/atom.php" />

	<?php	
		foreach ($album as $rs) {
	?>
	<entry>
		<author>
			<name>snout</name>			
		</author>
		<title type="html"><![CDATA[<?php echo $rs['album_name'];?> ~ <?php echo $rs['artists']['artist_name'];?>]]></title>
		<link rel="alternate" type="text/html" href="<?php echo FLEA::getAppInf('webAddr')."/index.php?controller=default";?>&amp;<?php echo "action=view";?>&amp;<?php echo 'id='.$rs['album_id'];?>" />
		<id><?php echo FLEA::getAppInf('webAddr')."/index.php?controller=default";?>&amp;<?php echo "action=view";?>&amp;<?php echo 'id='.$rs['album_id'];?></id>
		<summary type="html"><![CDATA[<?php echo $rs['album_intro'];?>]]></summary>
		<content type="html" xml:base="<?php echo FLEA::getAppInf('webAddr')."/index.php?controller=default";?>&amp;<?php echo "action=view";?>&amp;<?php echo 'id='.$rs['album_id'];?>"><![CDATA[<?php echo $rs['album_intro'];?>]]></content>
		<link rel="replies" type="text/html" href="<?php echo FLEA::getAppInf('webAddr')."/index.php?controller=default";?>&amp;<?php echo "action=view";?>&amp;<?php echo 'id='.$rs['album_id'];?>#comments" thr:count="0"/>
		<link rel="replies" type="application/atom+xml" href="<?php echo FLEA::getAppInf('webAddr');?>/atom.php" thr:count="0"/>
		<thr:total>0</thr:total>
	</entry>
	<?php
		}
	?>
</feed>
